﻿namespace TheSafety
{
    using Agent;
    using System;

    public class NotifyManager
    {
        public static void a(NotifyItem A_0)
        {
            Action action = null;
            EventHandler handler = null;
            EventHandler handler2 = null;
            <>c__DisplayClass7 class2;
            NotifyItem a = A_0;
            string str = "";
            str = str + a.d();
            if ((a.b() == NotifyState.New) && (a.e() != NotificationType.Error))
            {
                a.a(NotifyState.Hidden);
                if (action == null)
                {
                    action = new Action(class2.b);
                }
                ConfigManager.a(a.c().ToString(), (ConfigManager.b("notifyrepeateeach") == "Never") ? 2147483647.0 : (double.Parse(ConfigManager.b("notifyrepeateeach")) * 60000.0), action);
            }
            if (!a.a())
            {
                a.a(true);
                AgentMessageEventArgs args = new AgentMessageEventArgs();
                args.a(a.e());
                args.a(str);
                if (handler == null)
                {
                    handler = new EventHandler(class2.c);
                }
                args.b(handler);
                if (handler2 == null)
                {
                    handler2 = new EventHandler(class2.b);
                }
                args.a(handler2);
                args.a(((ConfigManager.b("notifywithin") == "Forever") || (a.e() == NotificationType.Error)) ? 0x7fffffff : (int.Parse(ConfigManager.b("notifywithin")) * 0x3e8));
                ConfigManager.m().b(null, args);
                if ((ConfigManager.b("notifyrepeateeach") == "Never") || (a.e() != NotificationType.Error))
                {
                    if (a.b() != NotifyState.Old)
                    {
                        a.a(NotifyState.Old);
                        ConfigManager.e(a.c().ToString());
                    }
                    a.a(true);
                }
            }
        }
    }
}

